package com.ruoyi.order.service.impl;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.app.Vo.ProductViewVo;
import com.ruoyi.order.mapper.ProductMapper;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.NewProductMapper;
import com.ruoyi.order.domain.NewProduct;
import com.ruoyi.order.service.INewProductService;
import com.ruoyi.common.core.text.Convert;

import com.ruoyi.order.domain.Vo.ProductVo;
import javax.annotation.Resource;

/**
 * 新产品表Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-04
 */
@Service
public class NewProductServiceImpl implements INewProductService 
{
    @Resource
    private NewProductMapper newProductMapper;
    @Resource
    private ProductMapper productMapper;
    /**
     * 查询新产品表
     * 
     * @param id 新产品表主键
     * @return 新产品表
     */
    @Override
    public NewProduct selectNewProductById(Integer id)
    {
        return newProductMapper.selectNewProductById(id);
    }

    /**
     * 查询新产品表列表
     * 
     * @param newProduct 新产品表
     * @return 新产品表
     */
    @Override
    public List<NewProduct> selectNewProductList(NewProduct newProduct)
    {

        return newProductMapper.selectNewProductList(newProduct);
    }

    /**
     * 新增新产品表
     * 
     * @param newProduct 新产品表
     * @return 结果
     */
    @Override
    public int insertNewProduct(NewProduct newProduct)
    {
        newProduct.setCreateTime(DateUtils.getNowDate());
        return newProductMapper.insertNewProduct(newProduct);
    }

    /**
     * 修改新产品表
     * 
     * @param newProduct 新产品表
     * @return 结果
     */
    @Override
    public int updateNewProduct(NewProduct newProduct)
    {
        newProduct.setUpdateTime(DateUtils.getNowDate());
        return newProductMapper.updateNewProduct(newProduct);
    }

    /**
     * 批量删除新产品表
     * 
     * @param ids 需要删除的新产品表主键
     * @return 结果
     */
    @Override
    public int deleteNewProductByIds(String ids)
    {
        return newProductMapper.deleteNewProductByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除新产品表信息
     * 
     * @param id 新产品表主键
     * @return 结果
     */
    @Override
    public int deleteNewProductById(Integer id)
    {
        return newProductMapper.deleteNewProductById(id);
    }

    @Override
    public List<ProductVo> getNewProductPage(String productName) {
        Map<String,Object> map = new HashMap<>();
        map.put("productName" , productName);
        map.put("state" , 0 );
        List<ProductVo> list = newProductMapper.getNewProductPage(map);
        return list;
    }

    @Override
    public List<ProductVo> getNewProductPageList() {
        Map<String,Object> map = new HashMap<>();
        map.put("state" , 0 );
        List<ProductVo> list = newProductMapper.getNewProductPageList(map);
        return list;
    }

    @Override
    public List<ProductViewVo> getNewRecommendation() {
        Map<String,Object> map = new HashMap<>();
        map.put("state" , 0 );
        List<ProductViewVo> list = newProductMapper.getNewRecommendation(map);
        return list;
    }

    @Override
    public boolean saveBatch(Collection<NewProduct> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<NewProduct> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean updateBatchById(Collection<NewProduct> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdate(NewProduct entity) {
        return false;
    }

    @Override
    public NewProduct getOne(Wrapper<NewProduct> queryWrapper, boolean throwEx) {
        return null;
    }

    @Override
    public Map<String, Object> getMap(Wrapper<NewProduct> queryWrapper) {
        return null;
    }

    @Override
    public <V> V getObj(Wrapper<NewProduct> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public BaseMapper<NewProduct> getBaseMapper() {
        return null;
    }

    @Override
    public Class<NewProduct> getEntityClass() {
        return null;
    }
}
